package com.qire.manhua.dal;

import com.qire.antsbinder.dal.DataWarehouse.MethodType;
import com.qire.antsbinder.dal.DataWarehouse.WarehouseCacheMode;
import com.qire.antsbinder.dal.annotation.DataAccess;
import com.qire.antsbinder.dal.annotation.ParamsAlias;
import com.qire.common.constant.Url;
import com.qire.manhua.dal.converter.BooleanToIntConverter;
import com.qire.manhua.model.vo.BeanExpenditureRecordVO;
import com.qire.manhua.model.vo.BeanExpiredRecordVO;
import com.qire.manhua.model.vo.BeanIncomeRecordVO;
import com.qire.manhua.model.vo.CoinExpenditureRecordVO;
import com.qire.manhua.model.vo.CoinIncomeRecordVO;
import com.qire.manhua.model.vo.FriendPaidInfoVO;
import com.qire.manhua.model.vo.FriendPaidOrderVO;
import com.qire.manhua.model.vo.MarketInfoVO;
import com.qire.manhua.model.vo.MembersPackageVO;
import com.qire.manhua.model.vo.NewcomerWelfareCheckVO;
import com.qire.manhua.model.vo.PurchaseHistoryVO;
import com.qire.manhua.model.vo.TradingOrderVO;
import com.qire.manhua.model.vo.TradingVerifyResponseVO;

/**
 * 交易数据
 */
public interface ITradingDataDAL {

    /**
     * 获取金币支出明细记录
     * @param pageNo 页号
     * @return
     */
    @DataAccess(url = Url.CoinExpenditureRecordData)
    CoinExpenditureRecordVO[] fetchCoinExpenditureRecord(@ParamsAlias(name = "page") int pageNo);
    /**
     * 获取金币收入明细记录
     * @param pageNo 页号
     * @return
     */
    @DataAccess(url = Url.CoinIncomeRecordData)
    CoinIncomeRecordVO[] fetchCoinIncomeRecord(@ParamsAlias(name = "page") int pageNo);


    /**
     * 获取金豆支出明细记录
     * @param pageNo 页号
     * @return
     */
    @DataAccess(url = Url.BeanExpenditureRecordData)
    BeanExpenditureRecordVO[] fetchBeanExpenditureRecord(@ParamsAlias(name = "page") int pageNo);
    /**
     * 获取金豆收入明细记录
     * @param pageNo 页号
     * @return
     */
    @DataAccess(url = Url.BeanIncomeRecordData)
    BeanIncomeRecordVO[] fetchBeanIncomeRecord(@ParamsAlias(name = "page") int pageNo);
    /**
     * 获取金豆过期明细记录
     * @param pageNo 页号
     * @return
     */
    @DataAccess(url = Url.BeanExpiredRecordData)
    BeanExpiredRecordVO[] fetchBeanExpiredRecord(@ParamsAlias(name = "page") int pageNo);


    /**
     * 已购买漫画数据
     * @param pageNo 页号
     * @return
     */
    @DataAccess(url = Url.PurchaseHistoryData)
    PurchaseHistoryVO[] fetchPurchaseHistoryData(@ParamsAlias(name = "page") int pageNo);


    /**
     * 检查新人首充福利资格，该接口一旦调用，如果具备首充资格则开启优惠过期倒计时，服务器及时一旦过期则无法享受改优惠
     * @param isEnable 是否启用优惠倒计时，true 启用 false 不启用仅仅检查
     * @return
     */
    @DataAccess(url = Url.WelfareCheckInfo)
    NewcomerWelfareCheckVO welfareCheck(@ParamsAlias(name = "is_chuangjian", converter = BooleanToIntConverter.class) boolean isEnable);

    /**
     * 获取带有首充福利资格的充值金币金豆市场信息
     * @return
     */
    @DataAccess(url = Url.MarketWelfareInfo, methodType = MethodType.GET)
    MarketInfoVO fetchMarketWelfareInfo();

    /**
     * 获取充值金币金豆市场购买选项信息
     */
    @DataAccess(url = Url.MarketInfo, methodType = MethodType.GET, cacheMode = WarehouseCacheMode.FIRST_CACHE_THEN_REQUEST)
    MarketInfoVO fetchMarketInfo();

    /**
     * 获取开通会员套餐选项信息
     */
    @DataAccess(url = Url.MembersPackage, methodType = MethodType.GET, cacheMode = WarehouseCacheMode.FIRST_CACHE_THEN_REQUEST)
    MembersPackageVO fetchMembersPackage();

    /**
     * 获取朋友代付选项信息
     */
    @DataAccess(url = Url.PayRechargeOption, methodType = MethodType.GET, cacheMode = WarehouseCacheMode.FIRST_CACHE_THEN_REQUEST)
    FriendPaidInfoVO fetchFriendPaidOptions();

    /**
     * 创建好友代付订单接口
     * @param payType   订单类型 1.充值 2.会员
     * @param payFee    支付金额
     * @return
     */
    @DataAccess(url = Url.CreateOrderPay)
    FriendPaidOrderVO createFriendPaidOrder(@ParamsAlias(name = "pay_type") int payType, @ParamsAlias(name = "fee") int payFee);

    //region    #交易支付订单相关 begin

    /**
     * 创建微信订单
     * @param fee   订单费用
     * @param productId 产品ID
     * @param orderType 订单类型 1 - 金币充值，2 - 购买VIP，注目前由于迭代原因，创建会员的接口和充值接口不在一个版本，故使用的算是不同接口
     * @param comicId   漫画书ID，如果不是从书籍跳转购买 则 为0
     * @param payPageName   购买页面名称（即activity类名简写）
     * @return
     */
    @DataAccess(url = Url.WeChatPlaceOrder)
    TradingOrderVO createWeChatOrder(@ParamsAlias(name = "fee") String fee, @ParamsAlias(name = "product_id") int productId,
                                     @ParamsAlias(name = "order_type") int orderType, @ParamsAlias(name = "book_id") int comicId,
                                     @ParamsAlias(name = "pay_activity") String payPageName);

    /**
     * 微信支付后校验接口
     * @param outTradeNo 外部订单号
     * @return
     */
    @DataAccess(url = Url.WeChatTradeVerify)
    TradingVerifyResponseVO tradingWeChatVerify(@ParamsAlias(name = "outTradeNo") String outTradeNo);

    /**
     * 创建支付宝订单
     * @param fee   订单费用
     * @param productId 产品ID
     * @param orderType 订单类型 1 - 金币充值，2 - 购买VIP，注目前由于迭代原因，创建会员的接口和充值接口不在一个版本，故使用的算是不同接口
     * @param comicId   漫画书ID，如果不是从书籍跳转购买，则为 0
     * @param payPageName   购买页面名称（即activity类名简写）
     * @return
     */
    @DataAccess(url = Url.AliPayPlaceOrder)
    TradingOrderVO createAliPayOrder(@ParamsAlias(name = "fee") String fee, @ParamsAlias(name = "product_id") int productId,
                                     @ParamsAlias(name = "order_type") int orderType, @ParamsAlias(name = "book_id") int comicId,
                                     @ParamsAlias(name = "pay_activity") String payPageName);

    /**
     * 支付宝支付后校验接口
     * @param outTradeNo    外部订单号
     * @param aliPayResult  支付宝支付结果
     * @return
     */
    @DataAccess(url = Url.AliPayTradeVerify)
    TradingVerifyResponseVO tradingAliPayVerify(@ParamsAlias(name = "outTradeNo") String outTradeNo,
                                                @ParamsAlias(name = "result") String aliPayResult);

    //endregion #交易支付订单相关 end

}
